/*
 * Copyright (c) 2001-2006 Accenture LLC.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * Accenture. ("Confidential Information"). You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Accenture.
 *
 * ACCENTURE MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE
 * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. ACCENTURE
 * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
 * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
 * DERIVATIVES.
 */
package org.tigris.jelements;

import org.tigris.mappedlexer.*;
import org.tigris.mappedlexer.implementation.*;
import org.tigris.mappedlexer.io.implementation.*;
import org.tigris.mappedlexer.validator.VerifyHub;

import org.springframework.beans.factory.*;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.FileSystemResource;

/**
 * @author zhisen.huang
 * 
 */
public class JElements {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		if(args.length < 1) {
			return;
		}
		
		BeanFactory beanFactory = new XmlBeanFactory(new FileSystemResource(
				"jelements-spring.xml"));
		Production production = (Production) beanFactory
				.getBean("compliationUnit");
		SimpleLexer lexer = new SimpleLexer(new FileCharInputSequence(args[0]));
		lexer.setAlphaNumericVerifier(VerifyHub.ALPHANUMERIC);
		lexer.setAlphaVerifier(VerifyHub.ALPHA);
		lexer.setNumericVerifier(VerifyHub.NUMERIC);
		lexer.setSpaceVerifier(VerifyHub.SPACE);
		
		production.setLexer(lexer);
		production.parse();
	}

}
